load(
    "//tools:defaults.bzl",
    "ng_module",
    "ng_test_library",
    "ng_web_test_suite",
    "sass_binary",
    "sass_library",
)

package(default_visibility = ["//visibility:public"])

ng_module(
    name = "mdc-snack-bar",
    srcs = glob(
        ["**/*.ts"],
        exclude = ["**/*.spec.ts"],
    ),
    assets = [
        ":simple_snack_bar_scss",
        ":snack_bar_container_scss",
    ] + glob(["**/*.html"]),
    module_name = "@angular/material-experimental/mdc-snack-bar",
    deps = [
        "//src:dev_mode_types",
        "//src/material-experimental/mdc-button",
        "//src/material-experimental/mdc-core",
        "//src/material/snack-bar",
        "@npm//@angular/core",
        "@npm//@material/snackbar",
    ],
)

sass_library(
    name = "mdc_snack_bar_scss_lib",
    srcs = glob(["**/_*.scss"]),
    deps = [
        "//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
        "//src/material/core:core_scss_lib",
    ],
)

sass_binary(
    name = "simple_snack_bar_scss",
    src = "simple-snack-bar.scss",
)

sass_binary(
    name = "snack_bar_container_scss",
    src = "snack-bar-container.scss",
    include_paths = [
        "external/npm/node_modules",
    ],
    deps = [
        "//src/material-experimental/mdc-helpers:mdc_helpers_scss_lib",
        "//src/material-experimental/mdc-helpers:mdc_scss_deps_lib",
    ],
)

###########
# Testing
###########

ng_test_library(
    name = "unit_test_sources",
    srcs = glob(
        ["**/*.spec.ts"],
        exclude = ["**/*.e2e.spec.ts"],
    ),
    deps = [
        ":mdc-snack-bar",
        "//src/cdk/a11y",
        "//src/cdk/overlay",
        "//src/cdk/platform",
        "@npm//@angular/common",
        "@npm//@angular/platform-browser",
    ],
)

ng_web_test_suite(
    name = "unit_tests",
    static_files = [
        "@npm//:node_modules/@material/snackbar/dist/mdc.snackbar.js",
        "@npm//:node_modules/@material/ripple/dist/mdc.ripple.js",
    ],
    deps = [
        ":unit_test_sources",
        "//src/material-experimental:mdc_require_config.js",
    ],
)
